<?php $this->load->view('Pre/common/header.html');?>
<script type="text/javascript" src="<?php echo base_url('common/home')?>/js/memberInfo.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>common/home/js/jquery.form.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>common/home/js/jquery.validate.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>common/home/js/additional-methods.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>common/home/js/validate.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>common/home/js/validateForm.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>common/js/jquery.Msg.js"></script>
<script type="text/javascript">
    $(function () {
        $.validate_update_d('ajax_form_d', 2, '<?php echo $customerModel->customer_id?>');
        $.validate_register('ajax_form_p');
    })
    function Success(data, index) {
        layer.close(index);
        $.Success(data);
    }
    function _Success(data) {
        $.Success(data);
    }
</script>

<input name="" type="hidden" value="" id="inputselect" />

<!--会员信息页 begin-->
<div class="memberPage">
    <h1>会员信息</h1>

    <!--基本资料 begin-->
    <div class="memberBar">
        <div class="memberTitle">
            <div class="memberTitleTxt">基本资料</div>
            <div class="memberTitleUp"></div>
        </div>
        <script type="text/javascript">
            $(function () {
                $("#p_url").val(parent.window.location.href);
                $("#backurl").val(parent.window.location.href);
            });
        </script>
        <div class="memberCon">
            <form id="ajax_form_d" action="<?php echo site_url('customer/update_d')?>" method="post">
                <input type="hidden" name="backurl" id="backurl" value="" />
                <input type="hidden" id="customer_id" name="customer_id" value="<?php echo $customerModel->customer_id?>" />
                <div class="userInfo">用户名：<input id="account" name="account" type="text" value="<?php echo $customerModel->account?>" disabled="disabled" /></div>
                <div class="userInfo">手机号：<input id="phone" name="phone" type="text" value="<?php echo $customerModel->phone?>" disabled="disabled" /></div>
                <div class="userInfo" style="border-right: none;">邮箱：<input id="email" name="email" type="text" value="<?php echo $customerModel->email?>" disabled="disabled" /></div>
                <div class="alter">修改</div>
                <div class="save"><input type="submit" value="保存" /></div>
            </form>
        </div>
    </div>
    <!--基本资料 end-->
    <!--修改密码 begin-->
    <div class="memberBar">
        <div class="memberTitle">
            <div class="memberTitleTxt">修改密码</div>
            <div class="memberTitleUp"></div>
        </div>

        <div class="memberCon">
            <form id="ajax_form_p" action="<?php echo site_url('customer/update_p')?>" method="post">
                <input type="hidden" name="p_url" id="p_url" value="" />
                <input type="hidden" id="customer_id" name="customer_id" value="<?php echo $customerModel->customer_id?>" />
                <div class="userInfo">原始密码：<input type="password" value="*********" disabled="disabled" /></div>
                <div class="userInfo">新密码：<input id="pass" name="pass" type="password" value="" disabled="disabled" /></div>
                <div class="userInfo" style="border-right: none;">确认新密码：<input id="passconf" name="passconf" type="password" value="" disabled="disabled" /></div>
                <div class="alter">修改</div>
                <div class="save"><input type="submit" value="保存" /></div>
            </form>
        </div>
    </div>
    <!--修改密码 end-->
    <!--发货地址 begin-->
    <div class="memberBar sendAddressInfo">
        <div class="memberTitle">
            <div class="memberTitleTxt">发货地址</div>
            <div class="memberTitleUp"></div>
        </div>

        <div class="memberCon">
            <ul>
                <?php foreach($customer_add_list as $customer_additem):?>
                <li class="defaultAddress">
                    <div class="sendName"><?php echo $customer_additem->c_name?></div>
                    <div class="sendMobile"><?php echo $customer_additem->phone?></div>
                    <div class="sendAddress">
                        <?php echo $customer_additem->province?>  <?php echo $customer_additem->city?>  <?php echo $customer_additem->county?>
                        <?php echo $customer_additem->detailed_add?>
                    </div>
                    <span style="margin-right:30px;" onclick="update_region(<?php echo $customer_additem->customer_region_id?>)">修改</span>
                    <span onclick="delete_region(<?php echo $customer_additem->customer_region_id?>)">删除</span>
                    <?php if($customer_additem->is_default==1):?>
                    <div class="default">默认收货地址</div>
                    <?php else:?>
                    <div class="default" style="cursor:pointer;" onclick="setdefault(<?php echo $customer_additem->customer_region_id?>)">设置默认收货地址</div>
                    <?php endif;?>
                </li>
                <?php endforeach;?>
                <li class="last">
                    <br />
                    <br />
                    <br />
                    +<br />
                    添加新地址
                </li>
            </ul>

            <div class="moreAddress">显示更多发货地址</div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $(".last").click(function () {
                layer.open({
                    type: 2,
                    title: false,
                    maxmin: false,
                    shadeClose: false, //开启点击遮罩关闭层
                    area: ['794px', '645px'],
                    offset: ['100px', ''],
                    closeBtn: 0,
                    content: '<?php echo site_url('customer/add_region/'.$customerModel->customer_id)?>' + '?backurl=' + window.location.href
                });
            });
        })

        function setdefault(cr_id) {
            var seturl = "<?php echo site_url('customer/set_default')?>";
            var backurl = window.location.href;
            $.post(seturl, { 'cr_id': cr_id, 'backurl': backurl }, function (data) {
                var jsonData = $.parseJSON(data);
                if (jsonData.Statu == 'ok') {
                    _Success(jsonData);
                } else {
                    _Success(jsonData);
                }
            });
        }


        function update_region(cr_id) {
            layer.open({
                type: 2,
                title: false,
                maxmin: false,
                shadeClose: false, //开启点击遮罩关闭层
                area: ['794px', '645px'],
                offset: ['100px', ''],
                closeBtn: 0,
                content: '<?php echo site_url('customer/update_region')?>?cr_id=' + cr_id + '&backurl=' + window.location.href
            });
        }
         function delete_region(cr_id) {
            var url = '<?php echo site_url('customer/delete_region')?>?cr_id=' + cr_id;
            $.post(url, { 'back_url': window.location.href }, function (data) {
                var jsonData = $.parseJSON(data);
                if (jsonData.Statu == 'ok') {
                    $.Success(jsonData);
                } else {
                    $.Success(jsonData);
                }
            });
        }

    </script>
    <!--发货地址 end-->
    <!--我的商城订单 begin-->
    <div class="memberBar storeOrder">
        <div class="memberTitle">
            <div class="memberTitleTxt">我的商城订单</div>
            <div class="memberTitleUp"></div>
        </div>

        <div class="memberCon">
            <div class="tableTitle">
                <div class="w320">商品</div>
                <div class="w270">属性</div>
                <div class="w140">单价（元）</div>
                <div class="w140">数量</div>
                <div class="w140">小计（元）</div>
                <div class="w188">操作</div>
            </div>
            <?php foreach($customer_order_list as $customer_order_item):?>
            <div class="orderBar">
                <div class="w320">
                    <a target="_blank" href="<?php echo site_url('goods/details/'.$customer_order_item->goods_id)?>">
                        <img src="<?php echo base_url().(!empty($customer_order_item->goodscolorimg)?$customer_order_item->goodscolorimg:$customer_order_item->thumbnail_img)?>" width="55" height="79" alt="" />
                        <div class="proName">
                            <?php echo $customer_order_item->goodstitle?>
                        </div>
                    </a>
                </div>
                <div class="w270">
                    颜色分类：<?php echo $customer_order_item->colortitle?><br />
                    尺码：<?php echo $customer_order_item->sizetitle?>
                </div>
                <div class="w140">￥<?php echo $customer_order_item->shop_price?></div>
                <div class="w140"><?php echo $customer_order_item->count?></div>
                <div class="w140 littleCount">￥<?php echo $customer_order_item->shop_price*$customer_order_item->count?></div>
                <div class="w188">
                    <span class="delete" onclick="del_order('<?php echo $customer_order_item->goods_order_id?>')">删除</span>
                    <?php if($customer_order_item->order_state==0):?>
                    <span><a target="_blank" style="color:#313131;" href="<?php echo site_url('order/order_pay/'.$customer_order_item->goods_order_id)?>">去付款</a></span>
                    <?php else:?>
                    <span><a target="_blank" style="color:#313131;" href="javascript:void(0)">已支付</a></span>
                    <?php endif;?>
                    <span class="orderTetail">订单详情</span>
                </div>

                <div class="orderDetailBox">
                    <h1>订单信息<span>关闭</span></h1>
                    <div class="orderBh">
                        <div class="bianhao">订单编号：</div>
                        <div class="bhCon"><?php echo $customer_order_item->order_code?> <span style="float:right;margin-right:20px;"><?php echo $customer_order_item->deliver_goods_state==1?'已发货':'未发货'?></span></div>
                    </div>
                    <div class="xiadanDate">
                        <div class="xiadan">下单时间：</div>
                        <div class="xdCon"><?php echo $customer_order_item->addtime?></div>
                    </div>
                    <div class="shdzh">
                        <div class="shh">收货地址：</div>
                        <div class="shhCon"><?php echo $customer_order_item->c_name?>，<?php echo !empty($customer_order_item->phone)?$customer_order_item->phone:$customer_order_item->tel?>，<?php echo $customer_order_item->province?> <?php echo $customer_order_item->city?> <?php echo $customer_order_item->county?> <?php echo $customer_order_item->detailed_add?></div>
                    </div>
                </div>
            </div>
            <?php endforeach;?>
            <script type="text/javascript">
                function del_order(order_id)
                {
                    var backurl = window.location.href;
                    var url = '<?php echo site_url('order/del_order')?>';
                    $.post(url, { 'order_id': order_id, 'backurl': window.location.href }, function (data) {
                        var jsonData = $.parseJSON(data);
                        if (jsonData.Statu == 'ok') {
                            $.Success(jsonData);
                        } else {
                            $.Success(jsonData);
                        }
                    });
                }
            </script>
        </div>
    </div>
    <!--我的商城订单 end-->
    <!--我的定制订单 begin-->
    <div class="memberBar curstomOrder">
        <div class="memberTitle">
            <div class="memberTitleTxt">我的商城订单</div>
            <div class="memberTitleUp"></div>
        </div>

        <div class="memberCon">
            <div class="tableTitle">
                <div class="w320">商品</div>
                <div class="w270">属性</div>
                <div class="w140">单价（元）</div>
                <div class="w140">数量</div>
                <div class="w140">小计（元）</div>
                <div class="w188">操作</div>
            </div>

            <div class="orderBar">
                <div class="w320">
                    <a href="">
                        <img src="<?php echo base_url('common/home')?>/img/product/01.jpg" width="55" height="79" alt="" />
                        <div class="proName">
                            高领条纹羊绒衫羊毛衫
                        </div>
                    </a>
                </div>
                <div class="w270">
                    颜色分类：黄色<br />
                    尺码：L
                </div>
                <div class="w140">￥699.00</div>
                <div class="w140">2</div>
                <div class="w140 littleCount">￥1308.00</div>
                <div class="w188"><span>删除</span></div>
            </div>

            <div class="orderBar">
                <div class="w320">
                    <a href="">
                        <img src="<?php echo base_url('common/home')?>/img/product/01.jpg" width="55" height="79" alt="" />
                        <div class="proName">
                            高领条纹羊绒衫羊毛衫
                        </div>
                    </a>
                </div>
                <div class="w270">
                    颜色分类：黄色<br />
                    尺码：L
                </div>
                <div class="w140">￥699.00</div>
                <div class="w140">2</div>
                <div class="w140 littleCount">￥1308.00</div>
                <div class="w188"><span>删除</span></div>
            </div>

            <div class="orderBar">
                <div class="w320">
                    <a href="">
                        <img src="<?php echo base_url('common/home')?>/img/product/01.jpg" width="55" height="79" alt="" />
                        <div class="proName">
                            高领条纹羊绒衫羊毛衫
                        </div>
                    </a>
                </div>
                <div class="w270">
                    颜色分类：黄色<br />
                    尺码：L
                </div>
                <div class="w140">￥699.00</div>
                <div class="w140">2</div>
                <div class="w140 littleCount">￥1308.00</div>
                <div class="w188"><span>删除</span></div>
            </div>
        </div>
    </div>
    <!--我的定制订单 end-->
</div>
<!--会员信息页 end-->
<?php $this->load->view('Pre/common/footer.html');?>
